<?php
$base64 = $_POST['formFile'];
$IMG = base64_decode( $base64 );
$fn = (isset($_POST['name']) ? $_POST['name'] : false);
file_put_contents(
        'upload/' . $fn,
        $IMG
    );
echo $fn;
?>